package com.example.entity;

import javax.persistence.*;
import java.sql.Date;
import java.util.Objects;

/**
 * @author Huangyt
 * @version 1.0
 * @date 2020/7/20 14:52
 */
@Entity
@Table(name = "account", schema = "abc")
public class Account {
    private int id;
    private String name;
    private Double money;
    private Date date;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "money")
    public Double getMoney() {
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    @Basic
    @Column(name = "date")
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Account that = (Account) o;
        return id == that.id &&
                Objects.equals(name, that.name) &&
                Objects.equals(money, that.money) &&
                Objects.equals(date, that.date);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, money, date);
    }
}
